'''
Created on 03/04/2011

@author: carlos
'''
import sys
import appindicator
import socket
import gtk


gtk.gdk.threads_init()

import threading

class Indicator (threading.Thread):
        
    def close_cliked(self, widget,data=None):
        sys.exit()
               
    def run(self):
        ind = appindicator.Indicator("iur-media-player", "rhythmbox-panel", appindicator.CATEGORY_APPLICATION_STATUS)
        ind.set_status(appindicator.STATUS_ACTIVE)
        menu = gtk.Menu()  
        close_item = gtk.MenuItem("Close")
        close_item.connect("activate", self.close_cliked)
        close_item.show()
        menu.append(close_item)
        ind.set_menu(menu)  
        
        gtk.gdk.threads_enter()
        gtk.main()
        gtk.gdk.threads_leave()
  
    def destroy(self, widget, data=None):
        gtk.main_quit()
        